package com.yh.correct.exception;

import org.apache.shiro.authz.UnauthorizedException;
import org.springframework.web.bind.annotation.ControllerAdvice;
import org.springframework.web.bind.annotation.ExceptionHandler;
import org.springframework.web.bind.annotation.ResponseBody;

import com.yh.correct.model.ResultData;


@ControllerAdvice
public class GlobalException {
		
	@ExceptionHandler(UnauthorizedException.class)
	public String getExp3(UnauthorizedException ex){
		return "refuse";
	}
	@ExceptionHandler(Exception.class)
	@ResponseBody
	public ResultData getExp5(Exception ex){
		ex.printStackTrace();
		ResultData rs=new ResultData();
		rs.setCode(4000);
		rs.setMessage("未知的异常！");
		return rs;
	}
}
